[WPB-27169] Do not count apps and collaborators as members in get-team-size. - #5445
Draft
fisx wants to merge 16 commits into
Draft
[WPB-27169] Do not count apps and collaborators as members in get-team-size.#5445fisx wants to merge 16 commits into
fisx wants to merge 16 commits into
Conversation
fisx
force-pushed
the
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size
branch
from
August 14, 2026 06:52
9bbc19f to
5f5d7d0
Compare
fisx
force-pushed
the
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size
branch
from
August 26, 2026 14:58
5f5d7d0 to
7c986b7
Compare
fisx
marked this pull request as ready for review
August 26, 2026 14:58
Contributor
There was a problem hiding this comment.
Pull request overview
This PR (WPB-27169) changes the meaning/shape of “team size” so that API-visible teamSize represents paid seats (regular users) while apps and collaborators are reported separately, and propagates that change through Galley/Brig, the indexed user store, journaling, and tests.
Changes:
- Redefines
TeamSizeto{teamSize, apps, collaborators}and updates JSON/OpenAPI schema plus golden fixtures. - Updates Galley/Brig logic and integration tests to treat apps/collaborators as non-members for
get-team-size. - Extends indexed user store implementations and team journaling/protobuf definitions to carry separate app/collaborator counts.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| services/galley/src/Galley/API/Teams.hs | Adjusts team-size bookkeeping and LegalHold-related checks to the new TeamSize shape. |
| services/galley/src/Galley/API/LegalHold/Team.hs | Updates LegalHold activation size check to use the new TeamSize representation. |
| services/brig/test/integration/API/Team.hs | Updates expected TeamSize JSON payload in Brig integration tests. |
| libs/wire-subsystems/test/unit/Wire/MockInterpreters/IndexedUserStore.hs | Updates mock team-size computation and adds collaborator counting. |
| libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs | Updates max-team-size checks to use teamSize (paid seats) only. |
| libs/wire-subsystems/src/Wire/TeamJournal.hs | Updates journal event payload generation for new app/collaborator fields. |
| libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs | Updates ES-based team-size result mapping to the new TeamSize fields. |
| libs/wire-api/test/golden/testObject_TeamSize_1.json | Refreshes golden JSON to new TeamSize schema. |
| libs/wire-api/test/golden/testObject_TeamSize_2.json | Refreshes golden JSON to new TeamSize schema. |
| libs/wire-api/test/golden/testObject_TeamSize_3.json | Refreshes golden JSON to new TeamSize schema (large-number case). |
| libs/wire-api/test/golden/testObject_Event_meeting_update_manual_1.json | Golden fixture update (field ordering/structure adjustment). |
| libs/wire-api/test/golden/testObject_Event_meeting_member_add_manual_2.json | Golden fixture update (field ordering/structure adjustment). |
| libs/wire-api/test/golden/testObject_Event_meeting_member_add_manual_1.json | Golden fixture update (field ordering/structure adjustment). |
| libs/wire-api/test/golden/testObject_Event_meeting_delete_manual_1.json | Golden fixture update (field ordering/structure adjustment). |
| libs/wire-api/test/golden/testObject_Event_meeting_create_manual_1.json | Golden fixture update (field ordering/structure adjustment). |
| libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/TeamSize.hs | Updates manual golden Haskell objects for TeamSize. |
| libs/wire-api/src/Wire/API/Team/Size.hs | Redefines TeamSize and updates its schema/Arbitrary instance. |
| libs/types-common-journal/proto/TeamEvents.proto | Changes TeamEvents event-data fields for app/collaborator counts. |
| integration/test/Test/TeamCollaborators.hs | Adds integration assertion that collaborators are counted separately in team size. |
| integration/test/Test/Apps.hs | Adds integration assertion that apps are counted separately in team size. |
| changelog.d/1-api-changes/WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size | Documents the API schema change for get-team-size and TeamEvents protobuf. |
Suppressed comments (1)
services/galley/src/Galley/API/Teams.hs:1082
- The LegalHold size check now sums
teamSize + apps + collaboratorshere, butensureNotTooLargeToActivateLegalHold(and the PR intent of “do not count apps/collaborators as members”) suggests onlyteamSizeshould be relevant. This inconsistency will make activation vs. later member/app changes apply different limits; please align the definition of what counts toward the LegalHold fanout size across all call sites.
pure case uType of
UserTypeFilterRegular -> n {teamSize = n.teamSize + 1}
UserTypeFilterApp -> n {apps = n.apps + 1}
ensureNotTooLargeForLegalHold tid (sizeAfterAdd.teamSize + sizeAfterAdd.apps + sizeAfterAdd.collaborators)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fisx
commented
Aug 26, 2026
blackheaven
reviewed
Aug 26, 2026
| @@ -1,5 +1,5 @@ | |||
| { | |||
| "teamSize": 0, | |||
Contributor
There was a problem hiding this comment.
Is it an intended breaking change?
fisx
force-pushed
the
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size
branch
from
August 27, 2026 13:28
6832456 to
c9c245d
Compare
Was previously UserSubsystem, but since it TeamCollaboratorsSubsystem is also used outside of Brig, that is not always available. Further changes: - Support BrigAPIAccess locally in Brig. - Change collaborator field type in UserDoc to collapse `Nothing` and `Just []` (remove the Maybe).
(I don't understand what it is about, and there is no author to ask.)
(This end-point only updates searchability settings, nothing else.)
This is only where we don't expect to use it. if we're wrong about this, a warning will be logged.
New schema: `{"teamSize": num, "apps": num, "collaborators": num}` (non-overlapping).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fisx
force-pushed
the
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size
branch
from
August 27, 2026 14:07
c9c245d to
7a33606
Compare
fisx
marked this pull request as draft
August 27, 2026 14:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #5173, #5213, #5452, where we added data about number of apps and collaborators to the
get-team-sizeresponse.Changes:
teamSizefield works again as it did in the olden days, only counting team members, which are regular users by definition.apps,collaborators, which contain the resp. counts.https://wearezeta.atlassian.net/browse/WPB-27169
Checklist
changelog.d